package com.wjx.article_sys.dao;

import com.wjx.article_sys.entity.Comment;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CommentMapper {

    //根据文章id查询评论
    @Select("select * from Comment where a_id=#{id} order by Commentid desc")
    public List<Comment> queryCommentByArticleId(Integer id);
    //添加评论
    @Insert("insert into Comment(Content,Author,Posttime,a_id) values(#{content},#{author},#{postTime},#{aId})")
    public void addComment(String content, String author, String postTime, Integer aId);
    //根据评论id修改评论内容
    @Update("update Comment set Content=#{content} where Commentid=#{id}")
    public void updateCommentById(Integer id,String content);
    //根据评论id删除评论
    @Delete("delete from Comment where Commentid=#{id}")
    public void deleteCommentById(Integer id);

}
